//
//  NetRequestClass.h
//  dongfengTest
//
//  Created by wxt on 2021/3/22.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NetRequestClass : NSObject
//定义返回请求数据的block类型
typedef void (^ReturnValueBlock) (id returnValue);
typedef void (^ErrorCodeBlock) (id errorCode);
typedef void (^FailureBlock)(void);

#pragma 监测网络的可链接性
/**
 *  检测网络是否连接
 *
 *  @param strUrl 网络连接字符串
 *
 *  @return 返回网络是否可连接 YES NO
 */
+ (BOOL)netWorkReachabilityWithURLString:(NSString *)strUrl;

#pragma POST请求
/**
 *  post 请求
 *
 *  @param requestURLString 请求的字符串
 *  @param parameter        请求的参数
 *  @param block            请求成功的block
 *  @param errorBlock       请求返回错误的block
 *  @param failureBlock     请求失败的block
 */
+ (void)NetRequestPOSTWithRequestURL:(NSString *)requestURLString
                       WithParameter:(NSDictionary *)parameter
                WithReturnValeuBlock:(ReturnValueBlock)block
                  WithErrorCodeBlock:(ErrorCodeBlock)errorBlock
                    WithFailureBlock:(FailureBlock)failureBlock;


// 登录相关接口 + Basic Auth
+ (void)TokenAuthNetRequestPOSTWithRequestURL:(NSString *)requestURLString
                                WithParameter:(NSDictionary *)parameter
                         WithReturnValeuBlock:(ReturnValueBlock)block
                           WithErrorCodeBlock:(ErrorCodeBlock)errorBlock
                             WithFailureBlock:(FailureBlock)failureBlock;



// 登录相关接口 + Basic Auth
+ (void)NotLoggedInNetRequestPOSTWithRequestURL:(NSString *)requestURLString
                                       WithType:(NSInteger)type
                                  WithParameter:(NSDictionary *)parameter
                           WithReturnValeuBlock:(ReturnValueBlock)block
                             WithErrorCodeBlock:(ErrorCodeBlock)errorBlock
                               WithFailureBlock:(FailureBlock)failureBlock;



#pragma GET请求




/**
 *  get 请求
*  @param requestURLString 请求的字符串
*  @param WithString        请求的参数
*  @param block            请求成功的block
*  @param errorBlock       请求返回错误的block
*  @param failureBlock     请求失败的block
 */
+ (void)TokenAuthNetRequestGETWithRequestURL:(NSString *)requestURLString
                                  WithString:(NSString *)parameter
               WithReturnValeuBlock:(ReturnValueBlock)block
                 WithErrorCodeBlock:(ErrorCodeBlock)errorBlock
                   WithFailureBlock:(FailureBlock)failureBlock;

/**
 *  get 请求
 *
 *  @param requestURLString 请求的字符串
 *  @param parameter        请求的参数
 *  @param block            请求成功的block
 *  @param errorBlock       请求返回错误的block
 *  @param failureBlock     请求失败的block
 */
+ (void)TokenAuthNetRequestGETWithRequestURL:(NSString *)requestURLString
                               WithParameter:(NSDictionary *)parameter
               WithReturnValeuBlock:(ReturnValueBlock)block
                 WithErrorCodeBlock:(ErrorCodeBlock)errorBlock
                   WithFailureBlock:(FailureBlock)failureBlock;

+ (void)NetRequestGETWithRequestURL:(NSString *)requestURLString
                WithParameter:(NSDictionary *)parameter
WithReturnValeuBlock:(ReturnValueBlock)block
  WithErrorCodeBlock:(ErrorCodeBlock)errorBlock
    WithFailureBlock:(FailureBlock)failureBlock;






+ (void)NetRequestPOSTImageWithParameter: (NSDictionary *) parameter image: (UIImage *) image
WithReturnValeuBlock: (ReturnValueBlock) block
  WithErrorCodeBlock: (ErrorCodeBlock) errorBlock
    WithFailureBlock: (FailureBlock) failureBlock;


+(void)cancelRequest;
@end

NS_ASSUME_NONNULL_END
